import React,{useReducer} from "react";
import myContext from "./myContext";
import { initState, reducer } from "./store";
import Son from "./Son";

export default function UseReducerDemo() {
  const [state, dispatch] = useReducer(reducer, initState);

  return (
    <myContext.Provider value={{state,dispatch}}>
      <div>
        <h1>useReducer和useContext结合实现redux的效果：</h1>
      </div>
      <hr></hr>
      <Son></Son>
    </myContext.Provider>
  );
}
